package com.nav.interpreter.brainfuck;

public enum BrainfuckChar {
	SHIFT_RIGHT, SHIFT_LEFT, INCREASE, DECREASE, OUTPUT, INPUT, OPEN, CLOSE;
	public static BrainfuckChar getInstance(char c) {
		switch(c) {
		case '>':
			return SHIFT_RIGHT;
		case '<':
			return SHIFT_LEFT;
		case '+':
			return INCREASE;
		case '-':
			return DECREASE;
		case '.':
			return OUTPUT;
		case ',':
			return INPUT;
		case '[':
			return OPEN;
		case ']':
			return CLOSE;
		}
		return null;
	}
	public String toString() {
		if(this == SHIFT_RIGHT)
			return ">";
		if(this == SHIFT_LEFT)
			return "<";
		if(this == INCREASE)
			return "+";
		if(this == DECREASE)
			return "-";
		if(this == OUTPUT)
			return ".";
		if(this == INPUT)
			return ",";
		if(this == OPEN)
			return "[";
		if(this == CLOSE)
			return "]";
		return null;
	}
}
